#include "pch.h"
#include "AirEffectDemo.h"
#include "Scene.h"
#include "RendererEngine.h"
#include "renderer.h"
#include "RendererEngine.h"


CAirEffectDemo::CAirEffectDemo()
{
	
}

CAirEffectDemo::~CAirEffectDemo()
{
	SafeRelease(mpAirEffect);
}

void CAirEffectDemo::init(mini::CEngine* pEngine)
{
	auto pRenderer = mini::CRendererEngine::getSinglePtr()->findRenderer(mini::RendererType::PostRenderer);
	if (nullptr != pRenderer)
	{
		mpAirEffect = new mini::CAirEffect();
		pRenderer->addEffect(mpAirEffect, 0);

		mini::CActor* pAcotor = new mini::CActor;
		pAcotor->initialise("resource/Mesh/Default/sphere.m", "resource/Material/airEffect.ma");
		mini::CRenderNode* pRenderNode = pEngine->createRenderNode();
		pRenderNode->bindActor(pAcotor, mini::RendererType::PostRenderer);
		pEngine->getCurrentScene()->addRenderNode(pRenderNode);
		pAcotor->setPosition(CVector(0, 2, 0));

		mpAirEffect->addActor(pAcotor);
	}
}
